package cz.muni.fi.pa036is.dtoconverters;

import cz.muni.fi.pa036is.dto.AddressTO;
import cz.muni.fi.pa036is.entity.Address;

/**
 *
 * @author Shebik
 */
public class AddressConverter {

    private AddressConverter() {
    }

    public static Address convertToAddress(final AddressTO addressTO) {
        Address address = new Address();
        address.setId(addressTO.getId());
        address.setStreet(addressTO.getStreetAndNumber());
        address.setCity(addressTO.getCity());
        address.setZipCode(addressTO.getZipCode());
        address.setCountry(addressTO.getCountry());
        return address;
    }

    public static AddressTO convertToAddressTO(final Address address) {
        AddressTO addressTO = new AddressTO();
        addressTO.setId(address.getId());
        addressTO.setStreetAndNumber(address.getStreet());
        addressTO.setCity(address.getCity());
        addressTO.setZipCode(address.getZipCode());
        addressTO.setCountry(address.getCountry());
        return addressTO;
    }
}
